﻿#region Copyrigth and License
/*==============================================================================
 *  Copyright (c) cndotnet.org Corporation.  All rights reserved.
 * ===============================================================================
 * This code and information is provided "as is" without warranty of any kind,
 * either expressed or implied, including but not limited to the implied warranties
 * of merchantability and fitness for a particular purpose.
 * ===============================================================================
 * Licensed under the GNU General Public License (GPL) v2
 * http://www.cndotnet.org/ucenter
 * ==============================================================================*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;

namespace UCenter.DataProvider
{
    public interface IRepository<T>
    {
        /// <summary>
        /// get single entry by dynamic query
        /// </summary>
        /// <param name="filter">query conditions</param>
        /// <param name="loadOptions">load options</param>
        /// <param name="values">values</param>
        /// <returns></returns>
        T GetSingle(string filter, DataLoadOptions loadOptions, params object[] values);

        /// <summary>
        /// get entrys by dynamic query
        /// </summary>
        /// <param name="filter">query conditions</param>
        /// <param name="loadOptions">load option</param>
        /// <param name="values">Parameter Values</param>
        /// <returns></returns>
        List<T> GetList(string filter, DataLoadOptions loadOptions, params object[] values);

        /// <summary>
        /// add
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        T Add(T obj);
    }
}
